COP3330-02 Object-Oriented Programming

 

Spring 2003

Program 5 (GUI)

Due:  April 17, 2003

 

Objectives:

The objectives of this assignment are to get hands-on experience:

 

Overview:

You will create an application that allows the user to create journal entries.  The user will enter a date, specify the nature of the entry, enter the text of the entry, and save the entry to disk.  The nature of any entry is either personal or business.

 

Warning:

You are to follow these instructions precisely.  Although you are encouraged to experiment with other widgets, do not do so on this program.  You are free to accomplish the GUI initialization in any order that you choose.  You are free to choose your own variable names if they are not specified here.

 

Specifics:

You will write 2 classes:  JournalFrame and JournalApp.

 

Class 1:  JournalFrame:

 

The following template should be used:

 

public class JournalFrame extends JFrame {

  // date label, textfield, and containing panel

  private JLabel dateLabel = new JLabel("Date: ");

  private JTextField dateField = new JTextField(20);

  private JPanel datePanel = new JPanel(new FlowLayout());

  ...

 

  public JournalFrame() {

    ...

  }

 

  private void initWidgets() {

    ...

  }

 

  private void saveEntry() {

    ...

  }

} // JournalFrame

 

The class JournalFrame,

 

Class 2:  JournalApp:

 

 

Screenshots:

Your windows should look like these:

 

Figure 1 Prior to Saving

 

Figure 2 After Sucessful Save

 

Figure 3 After Unsuccessful Save

 

Figure 4 Panel Breakdown

 

Submittal:

Submittals should follow the program specifications of the class.

 

Write-up:

There is no write-up required for this program.

 

Tips:

·       In the examples page, there is a class called ConsoleToFile (in the Input/Output download) that demonstrates how to write character data to a file.

·       In the examples page, there are plenty of GUI classes (in the GUI download) to use as examples.